/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.mobiubiq.directory.client.widget;

import java.util.Vector;
import org.kalmeo.kuix.widget.Widget;

/**
 *
 * @author Marnix Renne
 */
public class Form extends Widget {
    public static final String FORM_WIDGET_TAG = "form";
    private String action;
    private Vector inputs;

    public Form() {
        super(FORM_WIDGET_TAG);
        setId("form");
        inputs = new Vector();
    }

    public String getAction() {
        return action;
    }

    public Form setAction(String action) {
        this.action = action;
        return this;
    }

    public boolean setAttribute(String name, String value) {
        if ("action".equals(name)) {
            action = value;
            return true;
        } else {
            return super.setAttribute(name, value);
        }
    }

    protected void onChildAdded(Widget widget) {
        super.onChildAdded(widget);
        if(widget.getId() != null) {
            inputs.addElement(widget);
        }
    }
    
    public Vector getInputs() {
        return inputs;
    }
}
